package ca.liu.scaffoldingmvctest.web;

import org.junit.Test;

import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;

import org.springframework.context.ApplicationContext;

import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;

import org.springframework.test.context.ContextConfiguration;

import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.RequestScope;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.context.request.SessionScope;

/**
 * Unit test for the <code>StUserController</code> controller.
 *
 * @see ca.liu.scaffoldingmvctest.web.StUserController
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {
		"file:./src/main/resources/scaffoldingmvctest-security-context.xml",
		"file:./src/main/resources/scaffoldingmvctest-service-context.xml",
		"file:./src/main/resources/scaffoldingmvctest-dao-context.xml",
		"file:./src/main/resources/scaffoldingmvctest-web-context.xml" })
public class StUserControllerTest {
	/**
	 * The Spring application context.
	 *
	 */
	private ApplicationContext context;

	/**
	 * Test <code>editStUserStLogs()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GeteditStUserStLogs() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/editStUserStLogs");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StUserController controller = (StUserController) context.getBean("StUserController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>newStUserStLogs()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetnewStUserStLogs() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/newStUserStLogs");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StUserController controller = (StUserController) context.getBean("StUserController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>saveStUserStLogs()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetsaveStUserStLogs() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/saveStUserStLogs");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StUserController controller = (StUserController) context.getBean("StUserController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>confirmDeleteStUserStLogs()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetconfirmDeleteStUserStLogs() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/confirmDeleteStUserStLogs");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StUserController controller = (StUserController) context.getBean("StUserController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>deleteStUserStLogs()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetdeleteStUserStLogs() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/deleteStUserStLogs");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StUserController controller = (StUserController) context.getBean("StUserController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>selectStUserStLogs()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetselectStUserStLogs() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/selectStUserStLogs");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StUserController controller = (StUserController) context.getBean("StUserController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>listStUserStLogs()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetlistStUserStLogs() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/listStUserStLogs");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StUserController controller = (StUserController) context.getBean("StUserController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>indexStUser()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetindexStUser() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/indexStUser");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StUserController controller = (StUserController) context.getBean("StUserController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>selectStUser()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetselectStUser() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/selectStUser");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StUserController controller = (StUserController) context.getBean("StUserController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>editStUser()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GeteditStUser() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/editStUser");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StUserController controller = (StUserController) context.getBean("StUserController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>saveStUser()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetsaveStUser() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/saveStUser");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StUserController controller = (StUserController) context.getBean("StUserController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>newStUser()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetnewStUser() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/newStUser");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StUserController controller = (StUserController) context.getBean("StUserController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>confirmDeleteStUser()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetconfirmDeleteStUser() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/confirmDeleteStUser");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StUserController controller = (StUserController) context.getBean("StUserController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>deleteStUser()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetdeleteStUser() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/deleteStUser");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StUserController controller = (StUserController) context.getBean("StUserController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>stuserControllerbinaryaction()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetstuserControllerbinaryaction() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/stuserController/binary.action");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		StUserController controller = (StUserController) context.getBean("StUserController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Autowired to set the Spring application context.
	 *
	 */
	@Autowired
	public void setContext(ApplicationContext context) {
		this.context = context;
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("session", new SessionScope());
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("request", new RequestScope());
	}

	/**
	 * Returns a mock HttpServletRequest object.
	 *
	 */
	private MockHttpServletRequest getMockHttpServletRequest() {
		MockHttpServletRequest request = new MockHttpServletRequest();
		ServletRequestAttributes attributes = new ServletRequestAttributes(request);
		RequestContextHolder.setRequestAttributes(attributes);
		return request;
	}

	/**
	 * Returns a mock HttpServletResponse object.
	 *
	 */
	private MockHttpServletResponse getMockHttpServletResponse() {
		return new MockHttpServletResponse();
	}
}